use std::fs::{File, self};
use crate::study_enum::test_enum::Xt;
use study_macro::expr;

mod study_one;
mod study_two;
mod study_enum;
mod study_macro;
mod study_closure;

use crate::study_one::add::Animal;

fn main() {
    let mut a = 19;
    a = a + 32;

    println!("the b is {}", a);

    let v = vec![1, 2, 3, 4];
    let v2 = vec![1, 2, 3, 4];

    let a = test_some(String::from("Hello"));

    println!("the a is {}", a);
    // 测试rust的trait，相当于java中的interface
    study_one::add::Tiger::new("tiger").eat();
    let cat_name = String::from("cat");
    study_one::add::Cat::new(cat_name).eat();

    let hello = study_two::wechat::test_wechat();
    println!("the result str is {}", hello);

    // 测试枚举类
    Xt::print();
    let xt = Xt::Wallet;
    // 使用引用代替copy
    study_enum::test_enum::test_match(&xt);
    study_enum::test_enum::test_match(&xt);
    study_enum::test_enum::test_match(&Xt::House);

    expr::print_yoo();
    let add_int = add!(1, 3);
    let yuan = add!(1);
    println!("the addInt is {}, yuan is {}", add_int, yuan);
    println!("the add_as is {}", add_as!(1, 10, u8));

    println!("{}",add_as_one!(1,2,3,4)); // => println!("{}",{0+1+2+3+4})
    println!("{}",mul_as!(1,2,3,4)); // => println!("{}",{0+1+2+3+4})
    println!("{}",add_as_two!(1,2,3,4)); // => println!("{}",{0+1+2+3+4})

}

fn test_some(str: String) -> String {
    str + " World"
}


